home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 7 / 007.d81 / pps #14 < prev    next >
Text File  |  2022-08-26  |  2KB  |  110 lines

  1.  PEEKs, POKEs, and SYSes -- Part 14
  2.  
  3.          by Jimmy Weiler
  4.  
  5. ======================================
  6. Location:212     Hexadecimal:    $00d4
  7. Official Label: QTSW         Type: RAM
  8. Useful BASIC commands: PEEK, POKE
  9. ======================================
  10.  
  11.      QTSW is the 'quote switch'.
  12.  
  13.   You are probably very familiar with
  14.  
  15. quote mode.  You will type a quote and
  16.  
  17. suddenly all the cursor/color/ctrl
  18.  
  19. keys print as characters instead of
  20.  
  21. performing their functions.  That is
  22.  
  23. what allows you to use those keys in
  24.  
  25. print statements.
  26.  
  27.   Unfortunately, except while you are
  28.  
  29. writing a program, there is virtually
  30.  
  31. NO instance when you want to be in
  32.  
  33. quote mode.  That's where QTSW comes
  34.  
  35. in.
  36.  
  37. WHAT QTSW DOES:
  38.  
  39.   Every time the C-64 prints a quote
  40.  
  41. [CHR$(34)] on the screen, QTSW
  42.  
  43. toggles.  That means the value in
  44.  
  45. memory location 212 changes from 0 to
  46.  
  47. 1 or from 1 to 0.  If PEEK(212)=1 then
  48.  
  49. you are 'in quote mode' and nothing
  50.  
  51. will get you out of it except another
  52.  
  53. quote or a <SHIFT-RETURN>.  Printing
  54.  
  55. a carriage return will turn quote mode
  56.  
  57. off.
  58.  
  59. SO WHAT GOOD IS THIS?
  60.  
  61.   Let's write a tiny, worthless word
  62.  
  63. processor and see.
  64.  
  65. 10 GET K$: IF K$ = "" THEN 10
  66. 20 PRINT K$;
  67. 30 GOTO 10
  68.  
  69. This little program seems to work fine
  70.  
  71. (type something and see) until you
  72.  
  73. type a quote.  Suddenly the arrow
  74.  
  75. keys and clr/home and inst/del start
  76.  
  77. printing in reverse instead of
  78.  
  79. performing their functions.
  80.  
  81.   Now, let's clear the quote switch
  82.  
  83. after every key press.
  84.  
  85. 20 PRINT K$;: POKE 212,0
  86.  
  87. Now whatever key you type will perform
  88.  
  89. its normal function.
  90.  
  91.   Even if you don't write word
  92.  
  93. processors, you can use QTSW to make
  94.  
  95. your programs more user-proof.  If
  96.  
  97. you do GETs and carelessly let the
  98.  
  99. user put a quote on the screen your
  100.  
  101. program may seem to go completely
  102.  
  103. haywire.  POKE 212,0 after printing
  104.  
  105. the character that was 'GETted' will
  106.  
  107. prevent such quote related blow-ups.
  108.  
  109. --------------------------------------
  110.